//package com.aerospace.serviceprovider.netty;
//
//import io.netty.bootstrap.Bootstrap;
//import io.netty.buffer.Unpooled;
//import io.netty.channel.*;
//import io.netty.channel.nio.NioEventLoopGroup;
//import io.netty.channel.socket.SocketChannel;
//import io.netty.channel.socket.nio.NioSocketChannel;
//
///**
// * Netty客户端的程序
// *
// */
//public class client {
//    /*IP地址*/
//    static final String HOST = "127.0.0.1";
//    static final int PORT1 = 8080;
//    static final int PORT2 = 8081;
//
//    public static void main(String[] args) throws InterruptedException {
//        EventLoopGroup workgroup = new NioEventLoopGroup();
//        Bootstrap b = new Bootstrap();
////        b.group(workgroup)
////                .channel(NioSocketChannel.class)
////                .option(ChannelOption.SO_KEEPALIVE,true)
////                .handler(new ChannelInitializer<SocketChannel>() {
////                    @Override
////                    protected void initChannel(SocketChannel sc) throws Exception {
////                        sc.pipeline().addLast(new ClientHandler());
////                    }
////                });
//        //创建异步链接
//        ChannelFuture cf1 = b.connect(HOST,PORT1).sync();
//        ChannelFuture cf2 = b.connect(HOST,PORT2).sync();
//
//        //buf
//        //client向server端发送数据 buffer形式
//        cf1.channel().writeAndFlush(Unpooled.copiedBuffer("hello netty".getBytes()));
//        cf2.channel().writeAndFlush(Unpooled.copiedBuffer("hello world".getBytes()));
//
//        cf1.channel().closeFuture().sync();
//        cf2.channel().closeFuture().sync();
//
//        workgroup.shutdownGracefully();
//
//    }
//}
